<?php

	require_once('class.phpmailer.php');
	//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
	
	$mail             = new PHPMailer();
	
	$mail->IsSMTP(); // telling the class to use SMTP
	$mail->Host       = "ssl://host351.hostmonster.com";	// SMTP server
	$mail->SMTPDebug  = 2;                     				// enables SMTP debug information (for testing)
											   				// 1 = errors and messages
											   				// 2 = messages only
	$mail->SMTPAuth   = true;                  				// enable SMTP authentication
	$mail->Host       = "ssl://host351.hostmonster.com"; 	// sets the SMTP server
	$mail->Port       = 465;                    			// set the SMTP port for the GMAIL server
	$mail->Username   = "no-reply+people.com.py"; 			// SMTP account username
	$mail->Password   = "zQdnBi{25U2N";        				// SMTP account password
	
	$mail->SetFrom('no-reply@people.com.py', 'PEOPLE no-reply');
	
	$mail->Subject    = "Ha llegado un mensaje a traves del sitio web de PEOPLE";
	
	if($_POST['name']!='nope'){
		$messageBody .= '<p>Visitante: ' . $_POST["name"] . '</p>' . "\n";
		$messageBody .= '<br>' . "\n";
	}
	if($_POST['email']!='nope'){
		$messageBody .= '<p>Email del Visitante: ' . $_POST['email'] . '</p>' . "\n";
		$messageBody .= '<br>' . "\n";
	}else{
		$headers = '';
	}
	if($_POST['state']!='nope'){		
		$messageBody .= '<p>State: ' . $_POST['state'] . '</p>' . "\n";
		$messageBody .= '<br>' . "\n";
	}
	if($_POST['phone']!='nope'){		
		$messageBody .= '<p>Phone Number: ' . $_POST['phone'] . '</p>' . "\n";
		$messageBody .= '<br>' . "\n";
	}	
	if($_POST['fax']!='nope'){		
		$messageBody .= '<p>Fax Number: ' . $_POST['fax'] . '</p>' . "\n";
		$messageBody .= '<br>' . "\n";
	}
	if($_POST['message']!='nope'){
		$messageBody .= '<p>Mensaje: ' . $_POST['message'] . '</p>' . "\n";
	}
	
	/*if($_POST["stripHTML"] == 'true'){
		$messageBody = strip_tags($messageBody);
	}*/	
	
	$mail->MsgHTML($messageBody);
	
	$address = "info@people.com.py";
	$mail->AddAddress($address, "PEOPLE Consultora en Recursos Humanos");
	
	if(!$mail->Send()) {
	  echo "Mailer Error: " . $mail->ErrorInfo;
	} else {
	  echo "Message sent!";
	}

	/*ini_set('SMTP', 'ssl://smtp.gmail.com');
	ini_set('smtp_port', 587);
	ini_set('sendmail_from', 'david.eaj@gmail.com');
	ini_set('sendmail_path', "\"C:\David\xampp\sendmail\sendmail.exe\" -t");*/

	/*$owner_email = $_POST["owner_email"];
	$headers = 'From:' . $_POST["email"];
	$subject = 'A message from your site visitor ' . $_POST["name"];
	$messageBody = "";
	
	if($_POST['name']!='nope'){
		$messageBody .= '<p>Visitor: ' . $_POST["name"] . '</p>' . "\n";
		$messageBody .= '<br>' . "\n";
	}
	if($_POST['email']!='nope'){
		$messageBody .= '<p>Email Address: ' . $_POST['email'] . '</p>' . "\n";
		$messageBody .= '<br>' . "\n";
	}else{
		$headers = '';
	}
	if($_POST['state']!='nope'){		
		$messageBody .= '<p>State: ' . $_POST['state'] . '</p>' . "\n";
		$messageBody .= '<br>' . "\n";
	}
	if($_POST['phone']!='nope'){		
		$messageBody .= '<p>Phone Number: ' . $_POST['phone'] . '</p>' . "\n";
		$messageBody .= '<br>' . "\n";
	}	
	if($_POST['fax']!='nope'){		
		$messageBody .= '<p>Fax Number: ' . $_POST['fax'] . '</p>' . "\n";
		$messageBody .= '<br>' . "\n";
	}
	if($_POST['message']!='nope'){
		$messageBody .= '<p>Message: ' . $_POST['message'] . '</p>' . "\n";
	}
	
	if($_POST["stripHTML"] == 'true'){
		$messageBody = strip_tags($messageBody);
	}
	
	try{
		if(!mail($owner_email, $subject, $messageBody, $headers)){
			throw new Exception('mail failed');
		}else{
			echo 'mail sent';
		}
	}catch(Exception $e){
		echo $e->getMessage() ."\n";
	}*/
?>